#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  findhello.py
#       Author @  Huoty
#  Create date @  2015-06-27 23:29:37
#  Description @  
# *************************************************************

import sys

# Script starts from here

cnt = 0
fo = open("test.txt")

for line in fo:
    s = line
    sys.stdout.write(s)

    while s:
        index = s.find("hello")
        #print index
        if index >= 0:
            cnt += 1
            s = line[index + len("hello"):]
            #print cnt
        else:
            s = None

print "文件中“hello”的个数为：", cnt
